---@class Table_ComItemItem
local Table_ComItemItem = class("Table_ComItemItem");

function Table_ComItemItem:ctor()
    self.Id = 0;    --唯一ID
    self.Name = "";    --名称
    self.Desc = "";    --说明
    self.Icon = "";    --图标名称
    self.Atlas = "";    --图标图集
    self.Quality = 0;    --品质
    self.StackSize = 0;    --堆叠上限
    self.MaxStack = 0;    --总量上限
    self.ClassType = 0;    --道具类型
    self.StorageType = 0;    --存放类型
    self.UseType = 0;    --使用类型
    self.UseParam = 0;    --使用参数
    self.OutPath = "";    --产出途径
    self.OutType = 0;    --产出类型
    self.OutId = 0;    --表格Id
    self.IsSell = false;    --是否可以出售
    self.ResType = 0;    --卖出货币类型
    self.Price = 0;    --卖出价格
    self.SortId = 0;    --排序优先级
end

function Table_ComItemItem:Load(reader)
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Id = tonumber(self.temp); end
    self.Name = reader:ReadString();
    self.Desc = reader:ReadString();
    self.Icon = reader:ReadString();
    self.Atlas = reader:ReadString();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Quality = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.StackSize = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.MaxStack = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.ClassType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.StorageType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.UseType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.UseParam = tonumber(self.temp); end
    self.OutPath = reader:ReadString();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.OutType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.OutId = tonumber(self.temp); end
    self.IsSell = reader:ReadBool();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.ResType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Price = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.SortId = tonumber(self.temp); end
    self.temp = nil;
end

---@class Table_ComItemMgr : IDataMgr
local Table_ComItemMgr = class("Table_ComItemMgr", IDataMgr);

function Table_ComItemMgr:FileName()
    return "Txt/ComItem.txt";
end

---@return Table_ComItemItem
function Table_ComItemMgr:GetItemById(id)
    return self.super:GetItemById(id)
end

---@return Table_ComItemItem
function Table_ComItemMgr:GetItemByIdx(idx)
    return self.super:GetItemByIdx(idx)
end

function Table_ComItemMgr:Load(reader)
    local item = Table_ComItemItem.new();
    item:Load(reader);
    self.mItemDic[item.Id] = self.mDataCount;
    table.insert(self.mItemList, item);
end

return Table_ComItemMgr;